Howto setup a `veth` virtual network

Posted by Reinder on Super User See other posts from Super User or by Reinder
Published on 2014-06-07T20:18:05Z Indexed on 2014/06/07 21:28 UTC
Read the original article Hit count: 170

Filed under:
|
|

I'd like to setup three virtual network interfaces (veth) which can communicate with each other. To simulate a three node cluster, each program then binds to one veth interface. I'd like to do it without LXC if possible.

I tried using:

  • Created three veth pairs: sudo ip link add type veth
  • Created a bridge sudo brctl addbr br0
  • Added one of each pair to the bridge:
    • sudo brctl addif br0 veth1
    • sudo brctl addif br0 veth3
    • sudo brctl addif br0 veth5
  • Configured the interfaces:
    • sudo ifconfig veth0 10.0.0.201 netmask 255.255.255.0 up
    • sudo ifconfig veth2 10.0.0.202 netmask 255.255.255.0 up
    • sudo ifconfig veth4 10.0.0.203 netmask 255.255.255.0 up

Then I verified if is works using: ping -I veth0 10.0.0.202 but it doesn't :(

The I added IP addresses to the veth1,veth3,veth5 and br0 interfaces in the 10.0.1.x/24 range. But that doesn't help.

Any ideas? or a guide, all I find in how to use it with LXC. Or am I trying something that isn't possible?

© Super User or respective owner

Related posts about linux

Related posts about networking